package service

import (
	"context"
	"strconv"
	"study01/pb"
)

type productService struct {
	pb.UnimplementedProductServiceServer
}

var ProductService = &productService{}

func (p *productService) GetProductStock(context context.Context, request *pb.ProductRequest) (*pb.ProductResponse, error) {
	stock := p.GetStockById(request.ProdId)
	return &pb.ProductResponse{ProdStock: stock}, nil
}

func (p *productService) GetStockById(id int32) string {
	return "服务端收到：" + strconv.Itoa(int(id))
}
